<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="keywords" content="董哲朋,博客,杰森,工程师杰森,攻城狮杰森,程序员杰森,jason,jasoncoding,pdpeng.github.io,coder-jason,杰森,工程师,攻城狮,程序员,blog,杰森的博客,全栈杰森,Jason,全栈">
<meta name="description" content="董哲朋的个人技术博客，进军 BAT">
<meta name="baidu-site-verification" content="code-QreKZHvhxr" />
<meta name="google-site-verification" content="09pUELCUBq1DqCCF38Yh2tJ3Ym_AwCrftq7Nuj6RFKU" />
<meta name="baidu-site-verification" content="code-UgQbVCF7gr" />
<meta name="google-site-verification" content="2Z5MbRq2MYkpxhxZigsnWu_02ovzdGiRJNOzHc_yq58" />
<meta name="sogou_site_verification" content="kR3XmMWqhc" />
<meta name="viewport" content="width=device-width">
<meta name="referrer" content="no-referrer" /> <!--临时解决防盗链-->
<meta name="theme-color" content="#222" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: dark)"><meta name="generator" content="Hexo 6.3.0">

<link rel="preconnect" href="null//null" crossorigin>
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <meta name="google-site-verification" content="yRcH84LYotQhqYFJcwA5UzGRX_E_HGt7EWyA1hBqqWU">
  <meta name="msvalidate.01" content="yRcH84LYotQhqYFJcwA5UzGRX_E_HGt7EWyA1hBqqWU">
  <meta name="yandex-verification" content="8db608d56597d365">
  <meta name="baidu-site-verification" content="code-SSriojapxO">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"pdpeng.github.io","root":"/","images":"/images","scheme":"Mist","darkmode":true,"version":"8.11.1","exturl":true,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":true,"bookmark":{"enable":false,"color":"#222","save":"manual"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":"utterances","storage":true,"lazyload":true,"nav":null,"activeClass":"utterances"},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>



<link rel="canonical" href="https://pdpeng.github.io/2022/02/21/github-commit-pr/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://pdpeng.github.io/2022/02/21/github-commit-pr/","path":"2022/02/21/github-commit-pr/","title":"开源仓库贡献 —— 提交 PR"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>开源仓库贡献 —— 提交 PR | 攻城狮杰森</title>
  
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-5S6WNTLJG7"></script>
  <script class="next-config" data-name="google_analytics" type="application/json">{"tracking_id":"G-5S6WNTLJG7","only_pageview":false}</script>
  <script src="/js/third-party/analytics/google-analytics.js"></script>

  <script src="/js/third-party/analytics/baidu-analytics.js"></script>
  <script async src="https://hm.baidu.com/hm.js?11b3816992997637c6abc9c18c3eb3e5"></script>

  <script async src="//assets.growingio.com/2.1/gio.js"></script>
  <script class="next-config" data-name="growingio_analytics" type="application/json">"88ac8d4f08101068"</script>
  <script src="/js/third-party/analytics/growingio.js"></script>



  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<link rel="alternate" href="/atom.xml" title="攻城狮杰森" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">攻城狮杰森</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">董哲朋的博客</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">22</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">105</span></a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">28</span></a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%BA%8F"><span class="nav-number">1.</span> <span class="nav-text">序</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BF%AE%E6%94%B9%E9%A1%B5%E9%9D%A2%E5%B8%83%E5%B1%80"><span class="nav-number">2.</span> <span class="nav-text">修改页面布局</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#docsify-%E4%BB%8B%E7%BB%8D"><span class="nav-number">2.1.</span> <span class="nav-text">docsify 介绍</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E9%81%BF%E5%9D%91"><span class="nav-number">2.2.</span> <span class="nav-text">安装避坑</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%BA%94%E7%94%A8%E6%95%88%E6%9E%9C"><span class="nav-number">3.</span> <span class="nav-text">应用效果</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#PR-%E8%BF%87%E7%A8%8B"><span class="nav-number">4.</span> <span class="nav-text">PR 过程</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%93%E5%BA%93%E6%BA%90"><span class="nav-number">4.1.</span> <span class="nav-text">仓库源</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%BB%BA%E7%AB%8B%E7%A9%BA%E5%88%86%E6%94%AF"><span class="nav-number">4.2.</span> <span class="nav-text">建立空分支</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%9C%AC%E5%9C%B0%E4%BF%AE%E6%94%B9"><span class="nav-number">4.3.</span> <span class="nav-text">本地修改</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%8F%91%E5%B8%83-branch"><span class="nav-number">4.4.</span> <span class="nav-text">发布 branch</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#merge-branch"><span class="nav-number">4.5.</span> <span class="nav-text">merge branch</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#solve-merge-branch-error"><span class="nav-number">4.5.1.</span> <span class="nav-text">solve merge branch error</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA-PR"><span class="nav-number">4.6.</span> <span class="nav-text">创建 PR</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#finish-contributes"><span class="nav-number">5.</span> <span class="nav-text">finish contributes</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <a href="/">
    <img class="site-author-image" itemprop="image" alt="董哲朋"
      src="/images/head_portrait.png">
    </a>
  <p class="site-author-name" itemprop="name">董哲朋</p>
  <div class="site-description" itemprop="description" style="padding-bottom: 8px">A blacksmith must be strong</div>

<html>
<head>
    <style>
        .chat-button div {
            display: block;
            margin-top: 5px;
            background-color: transparent;
            position: relative;
            font-family: 'Lato', "PingFang SC", "Microsoft YaHei", sans-serif;
            font-size: 14px;
            line-height: 2;
        }

        .feed-link a {
            display: inline-block;
            padding: 0 15px;
            color: #fc6423;
            border: 2px solid #fc6423;
            border-radius: 6px;
            text-decoration: none;
        }

        .feed-link a:hover {
            background-color: #fc6423;
            border-bottom-color: #fc6423;
            color: #fff;
        }
    </style>
</head>

<body class="chat-button">
    <div class="feed-link" title="Q&A → Blog-Jason/community">
        <a target="_blank" rel="noopener" href="https://gitter.im/Blog-Jason/community">
            Q&A
        </a>
    </div>
</body>
</html>

</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">105</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">22</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">28</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly93d3cubGlua2VkaW4uY29tL2luL2Rvbmd6aGVwZW5n" title="Linkedin → https:&#x2F;&#x2F;www.linkedin.com&#x2F;in&#x2F;dongzhepeng"><i class="fab fa-linkedin fa-fw"></i>Linkedin</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly90d2l0dGVyLmNvbS9qYXNvbmk5OTY=" title="Twitter → https:&#x2F;&#x2F;twitter.com&#x2F;jasoni996"><i class="fab fa-twitter fa-fw"></i>Twitter</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOmR6aGVwZW5nQGdtYWlsLmNvbQ==" title="E-Mail → mailto:dzhepeng@gmail.com"><i class="fa fa-envelope fa-fw"></i>E-Mail</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9zdGFja292ZXJmbG93LmNvbS91c2Vycy8xNjY0ODc1NA==" title="S.O. → https:&#x2F;&#x2F;stackoverflow.com&#x2F;users&#x2F;16648754"><i class="fab fa-stack-overflow fa-fw"></i>S.O.</span>
      </span>
      <span class="links-of-author-item">
        <a href="/atom.xml" title="RSS → &#x2F;atom.xml"><i class="fa fa-rss fa-fw"></i>RSS</a>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L20wXzUxMjY5OTYx" title="CSDN → https:&#x2F;&#x2F;blog.csdn.net&#x2F;m0_51269961"><i class="fa-solid fa-c fa-fw"></i>CSDN</span>
      </span>
  </div>
  <div class="cc-license site-overview-item animated" itemprop="license">
    <span class="exturl cc-opacity" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC8="><img src="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary@2020.11.3/assets/license_badges/small/by_nc_sa.svg" alt="Creative Commons"></span>
  </div>



        </div>
      </div>

      
      <script type="text/javascript" charset="utf-8" src="/js/tagcloud.js"></script>
      <script type="text/javascript" charset="utf-8" src="/js/tagcanvas.js"></script>
      <div class="widget-wrap">
          <div id="myCanvasContainer" class="widget tagcloud">
              <canvas width="250" height="250" id="resCanvas" style="width:100%">
                  <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/ACM/" rel="tag">ACM</a><span class="tag-list-count">32</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/" rel="tag">C++</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CDN/" rel="tag">CDN</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CPU/" rel="tag">CPU</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/DNS/" rel="tag">DNS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Git/" rel="tag">Git</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/HarmonyOS/" rel="tag">HarmonyOS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Hexo/" rel="tag">Hexo</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IOS/" rel="tag">IOS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Java/" rel="tag">Java</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Linux/" rel="tag">Linux</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Markdown/" rel="tag">Markdown</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MySQL/" rel="tag">MySQL</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Python/" rel="tag">Python</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RT-Thread/" rel="tag">RT-Thread</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SQLServer/" rel="tag">SQLServer</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TCP-IP/" rel="tag">TCP&#x2F;IP</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Tomcat/" rel="tag">Tomcat</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Vivado/" rel="tag">Vivado</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%BA%91%E5%AD%98%E5%82%A8/" rel="tag">云存储</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%89%8D%E7%AB%AF/" rel="tag">前端</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" rel="tag">服务器</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%A8%8B%E5%BA%8F%E4%BA%BA%E7%94%9F/" rel="tag">程序人生</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BC%96%E7%A0%81/" rel="tag">编码</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%81%8C%E4%B8%9A%E8%AE%A4%E8%AF%81/" rel="tag">职业认证</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88/" rel="tag">解决方案</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%A7%A3%E6%9E%90%E5%87%A0%E4%BD%95/" rel="tag">解析几何</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89/" rel="tag">计算机视觉</a><span class="tag-list-count">1</span></li></ul>
              </canvas>
          </div>
      </div>
      
        <div class="back-to-top animated" role="button" aria-label="返回顶部">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="reading-progress-bar"></div>

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL1BEUEVORw==" title="Follow Jason on GitHub" aria-label="Follow Jason on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://pdpeng.github.io/2022/02/21/github-commit-pr/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/head_portrait.png">
      <meta itemprop="name" content="董哲朋">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="攻城狮杰森">
      <meta itemprop="description" content="A blacksmith must be strong">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="开源仓库贡献 —— 提交 PR | 攻城狮杰森">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          开源仓库贡献 —— 提交 PR
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2022-02-21 20:46:40" itemprop="dateCreated datePublished" datetime="2022-02-21T20:46:40+08:00">2022-02-21</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/" itemprop="url" rel="index"><span itemprop="name">版本控制</span></a>
        </span>
    </span>

  
    <span id="/2022/02/21/github-commit-pr/" class="post-meta-item leancloud_visitors" data-flag-title="开源仓库贡献 —— 提交 PR" title="阅读次数">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span class="leancloud-visitors-count"></span>
    </span>
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>2.1k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>2 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <blockquote>
<p>记录下第一个 <strong>pull request</strong> 被 <strong>merge</strong> 的过程</p>
</blockquote>
<h1 id="序"><a href="#序" class="headerlink" title="序"></a>序</h1><p>前些天在逛 Github 时，发现了一个有趣的项目 <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3Bob2RhbC9naXRodWI=">Github 漫游指南<i class="fa fa-external-link-alt"></i></span>，其作者经验非常的丰富，用自己的亲身经历为我们讲述了如何使用 Github 以及如何找到好的项目，感兴趣的小伙伴可以阅读学习</p>
<p>因为我没有下载其他专门的格式去阅读，而是采用了 <strong>在线阅读</strong> 的方式，但在这过程中我发现了很多的问题，阅读体验很差劲</p>
<ul>
<li>无法返回顶部</li>
<li>侧边栏没有层级目录显示</li>
<li>阅读记录无法保存（每次打开都需要从头开始查找）</li>
</ul>
<p>于是我便想为这个项目做些什么……</p>
<span id="more"></span>

<h1 id="修改页面布局"><a href="#修改页面布局" class="headerlink" title="修改页面布局"></a>修改页面布局</h1><h2 id="docsify-介绍"><a href="#docsify-介绍" class="headerlink" title="docsify 介绍"></a>docsify 介绍</h2><p>查阅了很多资料，最终我找到了 <strong>docsify</strong>，这样一款文档神器，以下介绍来自<span class="exturl" data-url="aHR0cHM6Ly9kb2NzaWZ5LmpzLm9yZy8=">官方文档<i class="fa fa-external-link-alt"></i></span></p>
<blockquote>
<p>docsify是一个神奇的文档网站生成器。他可以快速帮你生成文档网站。不同于GitBook、Hexo的地方是它不会生成静态的.html文件，所有转换工作都是在运行时。如果你想要开始使用他，只需要创建一个index.html就可以开始编写文档并直接部署在GitHub Pages 。</p>
</blockquote>
<h2 id="安装避坑"><a href="#安装避坑" class="headerlink" title="安装避坑"></a>安装避坑</h2><p>大家在使用命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i docsify-cli -g</span><br></pre></td></tr></table></figure>

<p>全局安装 <code>docsify-cli</code> 工具时，如果你在安装 <code>node.js</code> 时修改了默认的路径： <code>node_global</code> 和 <code>node_cache</code> ，在运行全局安装命令之后可能会出错，这里需要找到默认的脚本 <code>docsify.cmd</code> ，将其路径添加到环境变量</p>
<p><img src="https://img-blog.csdnimg.cn/05137d3fe1534910a650780d9018049d.png"></p>
<p>避免后续系统无法识别 <code>docsify</code> 命令，其他的我们按照文档配置就好啦，如果需要完全卸载重新安装，请使用命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm uninstall -g docsify</span><br></pre></td></tr></table></figure>

<h1 id="应用效果"><a href="#应用效果" class="headerlink" title="应用效果"></a>应用效果</h1><p><img src="https://img-blog.csdnimg.cn/5cfc5869bf5c4d029c524f546fa9672b.gif"></p>
<p>怎么样，是不是非常的简洁，有木有爱上读文档呢？大家感兴趣的话，可以<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIucGhvZGFsLmNvbS8jL2NoYXB0ZXIvR2l0aHViJUU2JUJDJUFCJUU2JUI4JUI4JUU2JThDJTg3JUU1JThEJTk3">点击这里<i class="fa fa-external-link-alt"></i></span>在线阅读</p>
<h1 id="PR-过程"><a href="#PR-过程" class="headerlink" title="PR 过程"></a>PR 过程</h1><h2 id="仓库源"><a href="#仓库源" class="headerlink" title="仓库源"></a>仓库源</h2><p>首先 <strong>fork</strong> 仓库</p>
<p><img src="https://img-blog.csdnimg.cn/50dc42afe25e4c41b86d06ea63557a23.png"></p>
<p>然后 <strong>clone</strong> 到本地，推荐安装 <strong>github desktop</strong> 工具，<span class="exturl" data-url="aHR0cHM6Ly9kZXNrdG9wLmdpdGh1Yi5jb20v">点我下载<i class="fa fa-external-link-alt"></i></span>，用本地编辑器打开</p>
<p><img src="https://img-blog.csdnimg.cn/3533e037b49643848f6bef26ee2014d4.png"></p>
<p>默认 vscode</p>
<p><img src="https://img-blog.csdnimg.cn/4a4ea0c4dde843cda8f91bc361e2ad89.png"></p>
<h2 id="建立空分支"><a href="#建立空分支" class="headerlink" title="建立空分支"></a>建立空分支</h2><p>创建一个新的分支，用于添加你想要实现的功能，这里我选择创建一个全新的 <strong>空分支</strong>，因为改动比较大，不用一步步删除</p>
<p>使用 <code>git checkout</code> 中 <code>-orphan</code> 参数：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git checkout --orphan emptybranch</span><br></pre></td></tr></table></figure>

<p>该命令会生成一个名为 <code>emptybranch</code> 的分支，该分支会包含父分支的所有文件。但新的分支不会指向任何以前的提交，无任何历史，你当前的提交将会成为该分支的首次提交记录</p>
<p>删除全部文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">rm</span> -rf . //结尾有 . </span><br></pre></td></tr></table></figure>

<p>若无任何文件提交，则无法查看分支，所以我们创建一个新的文件，然后提交</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;# creat new branch&#x27;</span> &gt;&gt; README.md</span><br><span class="line"></span><br><span class="line">git add README.md</span><br><span class="line"></span><br><span class="line">git commit -m <span class="string">&#x27;creat new branch&#x27;</span></span><br></pre></td></tr></table></figure>

<p><code>push</code> 到远程仓库，完成空分支的创建</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git push origin emptybranch</span><br></pre></td></tr></table></figure>

<h2 id="本地修改"><a href="#本地修改" class="headerlink" title="本地修改"></a>本地修改</h2><p>这里不做详细解释，主要以应用 <code>docsify</code> 为例介绍下 <strong>PR</strong> 过程，根据<span class="exturl" data-url="aHR0cHM6Ly9kb2NzaWZ5LmpzLm9yZy8jL3poLWNuL3F1aWNrc3RhcnQ=">文档<i class="fa fa-external-link-alt"></i></span>配置好本地环境</p>
<h2 id="发布-branch"><a href="#发布-branch" class="headerlink" title="发布 branch"></a>发布 branch</h2><p>本地预览无误后发布分支，我们在 <strong>github desktop</strong> 中可以很轻易的完成</p>
<p><img src="https://img-blog.csdnimg.cn/e2d046a5cb904c2683f51db3ab81152d.png"></p>
<p>因为我已经提交过了，就不在回退展示</p>
<h2 id="merge-branch"><a href="#merge-branch" class="headerlink" title="merge branch"></a>merge branch</h2><p>我们的空分支中已经实现了想要的功能，但是 git 中创建 PR 请求必须有一个父节点，否则会有（您所选的分支和想要合并分支间无任何关联）的类似提示，所以我们需要将这个空分支合并到仓库原来的分支上再做 PR</p>
<p>切换到 master 分支</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git  checkout master</span><br></pre></td></tr></table></figure>

<p>拉取远端的 master，保证最新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git pull origin master</span><br></pre></td></tr></table></figure>

<p>将空分支合并到 master</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git  merge emptybranch</span><br></pre></td></tr></table></figure>

<h3 id="solve-merge-branch-error"><a href="#solve-merge-branch-error" class="headerlink" title="solve merge branch error"></a>solve merge branch error</h3><p>合并分支时可能会遇到这样的报错</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fatal: refusing to merge unrelated histories</span><br></pre></td></tr></table></figure>

<p>主要是两个分支尚未取得联系</p>
<p>我们在操作的命令后加上 <code>--allow-unrelated-histories</code> 来解决这个报错，例如：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git merge emptybranch --allow-unrelated-histories</span><br></pre></td></tr></table></figure>

<blockquote>
<p>其实你也可以直接建立 branch，无需建立空分支，从而省去解决 <code>fatal: refusing to merge unrelated histories</code> 错误的操作</p>
</blockquote>
<h2 id="创建-PR"><a href="#创建-PR" class="headerlink" title="创建 PR"></a>创建 PR</h2><p>现在返回网页端中你 clone 仓库的位置，就会有提示 <strong>Compare &amp; Creat a pullrequest</strong> ，点击选中分支，记录下你实现的功能，确认无误提交后等待被仓库的主人合并就好啦</p>
<p>或者你也可以直接到源仓库地址找到 PR 入口，开始创建</p>
<p><img src="https://img-blog.csdnimg.cn/289b2dc567284f18969ac6cf64f9b716.png"></p>
<h1 id="finish-contributes"><a href="#finish-contributes" class="headerlink" title="finish contributes"></a>finish contributes</h1><p>这里放上 merge 后的截图，hah，我也非常感谢作者哈，<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3Bob2RhbC9naXRodWIvcHVsbC82OA==">PR address<i class="fa fa-external-link-alt"></i></span></p>
<p><img src="https://img-blog.csdnimg.cn/e8657a3815da4e48a6a1e039b73d871a.png"></p>
<p><img src="https://img-blog.csdnimg.cn/2b204addfa094b92a0fe74a7d950757b.png"><br>在一个技术社区和其他开发者交流，就像写博客可以得到一些回应一样，我们都将不断进步，比昨天的自己更强一些</p>
<p>看到自己所做的东西被认可是一件很棒的事情，虽然我也只是用了其他的工具做了一些简单的修改罢了。总之，Github 上真的有很多有趣的事情，你也可以通过学习<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3Bob2RhbC9naXRodWI=">《Github 漫游指南》<i class="fa fa-external-link-alt"></i></span>来找到一些自己喜欢的东西，开源大法是真滴好诶</p>
<p><img src="https://img-blog.csdnimg.cn/ae9b1580dd644801b061945fc210987a.png"></p>

    </div>

    
    
    

    <footer class="post-footer">

        </br>
        <div class="official-accounts">
             <a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/PDPENG/jason-storage/blog-img/Jason%20wechat%20account.png">
                 <img src="/images/official-accounts.png" width="80%">
             </a>
        </div>
          <div class="reward-container">
  <div>Thank you for your support to Jason ~</div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="/images/wechatpay.png" alt="董哲朋 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="/images/alipay.png" alt="董哲朋 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>董哲朋
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://pdpeng.github.io/2022/02/21/github-commit-pr/" title="开源仓库贡献 —— 提交 PR">https://pdpeng.github.io/2022/02/21/github-commit-pr/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC8="><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/tags/Git/" rel="tag"><i class="fa fa-tag"></i> Git</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2022/03/22/multiple-version-jdk/" rel="prev" title="Windows 下同时安装多个版本的 JDK">
                  <i class="fa fa-chevron-left"></i> Windows 下同时安装多个版本的 JDK
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2022/02/20/vscode-terminal-gitbash/" rel="next" title="修改 Vscode 终端为 git bash">
                  修改 Vscode 终端为 git bash <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments utterances-container"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">
<div class="copyright">
  &copy; 2020 – 
  <span itemprop="copyrightYear">2025</span>
  <span class="with-love">
    <i class="fa fa-code"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">董哲朋


<div class="sitetime" style="display: inline-block;">
<span id="sitetime"></span>
<script language=javascript>
	function siteTime(){
		window.setTimeout("siteTime()", 1000);
		var seconds = 1000;
		var minutes = seconds * 60;
		var hours = minutes * 60;
		var days = hours * 24;
		var years = days * 365;
		var today = new Date();
		var todayYear = today.getFullYear();
		var todayMonth = today.getMonth()+1;
		var todayDate = today.getDate();
		var todayHour = today.getHours();
		var todayMinute = today.getMinutes();
		var todaySecond = today.getSeconds();
		var t1 = Date.UTC(2020,09,23,13,15,00); //北京时间 2021-09-23 13:15:00
		var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
		var diff = t2-t1;
		var diffYears = Math.floor(diff/years);
		var diffDays = Math.floor((diff/days)-diffYears*365);
		var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
		var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
		var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
		document.getElementById("sitetime").innerHTML=" 本站已安全运行 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒 ";
	}
	siteTime();
</script>
</div>
  </span>
</div>
<div class="wordcount" style="display: inline-block;">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">312k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">4:43</span>
  </span>
    <div class="beian" style="display: inline-block;">
        <img src="/images/beian.png" alt=""><span class="exturl" data-url="aHR0cDovL3d3dy5iZWlhbi5nb3YuY24vcG9ydGFsL3JlZ2lzdGVyU3lzdGVtSW5mbz9yZWNvcmRjb2RlPTQxMDU4MTAyMDAwMjQx">豫公网安备 41058102000241号 </span>
        <img src="/images/beian.png" alt=""><span class="exturl" data-url="aHR0cHM6Ly9iZWlhbi5taWl0Lmdvdi5jbg==">豫ICP备2021028259号-1 </span>
    </div>

</div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@next-theme/pjax@0.5.0/pjax.min.js" integrity="sha256-3NkoLDrmHLTYj7csHIZSr0MHAFTXth7Ua/DDt4MRUAg=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  
<script src="https://cdn.jsdelivr.net/npm/hexo-generator-searchdb@1.4.0/dist/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>



  <script src="/js/third-party/fancybox.js"></script>


  


  <script class="next-config" data-name="leancloud_visitors" type="application/json">{"enable":true,"app_id":"XnAU2LpE7JlHt34KKmw24BoM-MdYXbMMI","app_key":"vphcyLncudT8YkHIgks4F1r2","server_url":null,"security":false}</script>
  <script src="/js/third-party/statistics/lean-analytics.js"></script>


  

  <script class="next-config" data-name="enableMath" type="application/json">false</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js","integrity":"sha256-r+3itOMtGGjap0x+10hu6jW/gZCzxHsoKrOd7gyRSGY="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


<script src="https://cdn.jsdelivr.net/gh/PDPENG/live2d-widget@latest/autoload.js"></script><script class="next-config" data-name="utterances" type="application/json">{"enable":true,"repo":"PDPENG/pdpeng.github.io","issue_term":"pathname","theme":"preferred-color-scheme"}</script>
<script src="/js/third-party/comments/utterances.js"></script>

</body>
</html>
